package test.multi_thread;

import java.lang.management.ManagementFactory;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import base.BaseObject;

public class CachedThreadPool extends BaseObject{
	
	private static final String TAG = "CachedThreadPool";

	public static void main(String[] args) {
		ExecutorService exec = Executors.newCachedThreadPool();
		
		String info = "  ";
		info += "pidInfo==";
		info += ManagementFactory.getRuntimeMXBean().getName();
		info += "\t thread==";
		info += Thread.currentThread().getName();
		
		
		mLog.i(TAG, "main start  "  + info);
		for (int i=0; i<3; i++){
			exec.execute(new LiftOff());
		}
		exec.shutdown();
		mLog.i(TAG, "main end  "  + info);
		
		
//		mLog.i(TAG, "main start  "  + info);
//		LiftOff mLiftOff = new LiftOff();
//		for (int i=0; i<3; i++){
//			exec.execute(mLiftOff);
//		}
//		exec.shutdown();
//		mLog.i(TAG, "main end  "  + info);
		
		
//		mLog.i(TAG, "main start  "  + info);
//		SynchLiftOff mLiftOff = new SynchLiftOff();
//		for (int i=0; i<3; i++){
//			exec.execute(mLiftOff);
//		}
//		exec.shutdown();
//		mLog.i(TAG, "main end  "  + info);
		
		
//		mLog.i(TAG, "main start  "  + info);
//		for (int i=0; i<3; i++){
//			exec.execute(new SynchLiftOff());
//		}
//		exec.shutdown();
//		mLog.i(TAG, "main end  "  + info);
	}

}
